package com.example.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.entity.Roles;
import com.example.entity.Students;
import com.example.entity.StudentsVO;
import com.example.entity.User;
import com.example.entity.UserVO;
import com.example.mapper.UserMapper;
import com.example.service.UserService;

@Service
public class UserSeviceImpl implements UserService {
	
	@Autowired
	private UserMapper userMapper;

	@Override
	public List<User> GetUsersLayUI(UserVO userVO) {
		// TODO Auto-generated method stub
		return userMapper.GetUsersLayUI(userVO);
	}

	@Override
	public int getCount(UserVO userVO) {
		// TODO Auto-generated method stub
		return userMapper.getCount(userVO);
	}
	/**
	 * 创建用户
	 */
	@Override
	public int addUser(User user) {
		// TODO Auto-generated method stub
		return userMapper.addUser(user);
	}
	/**
	 * 更新用户
	 */
	@Override
	public int upUser(User user) {
		// TODO Auto-generated method stub
		return userMapper.upUser(user);
	}
	/**
	 * 根据id删除用户
	 */
	@Override
	public int delUser(int id) {
		// TODO Auto-generated method stub
		return userMapper.delUser(id);
	}
	
	/**
	 * 重置密码
	 */
	@Override
	public int ResetPassword(String id) {
		// TODO Auto-generated method stub
		return userMapper.ResetPassword(id);
	}
	@Override
	public User selectByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return userMapper.selectByPrimaryKey(id);
	}
	
	@Override
	public User selectByNameAndPwd(String loginName, String password) {
		// TODO Auto-generated method stub
		return userMapper.selectByNameAndPwd(loginName, password);
	}


	@Override
	public User selectByName(String loginName) {
		// TODO Auto-generated method stub
		return userMapper.selectByName(loginName);
	}

	@Override
	public List<User> selectListAll() {
		// TODO Auto-generated method stub
		return userMapper.selectListAll();
	}
	/**
	 * 查询用户id
	 */
	@Override
	public List<Roles> getRolesByUid(String userid) {
		// TODO Auto-generated method stub
		return userMapper.getRolesByUid(userid);
	}

	@Override
	public List<Roles> GetRolesAll() {
		// TODO Auto-generated method stub
		return userMapper.GetRolesAll();
	}
	
	/**
	 * 锁定
	 */
	@Override
	public int islock(int id) {
		// TODO Auto-generated method stub
		return userMapper.islock(id);
	}
	/**
	 * 解锁
	 */
	@Override
	public int noIslock(int id) {
		// TODO Auto-generated method stub
		return userMapper.noIslock(id);
	}
	
	/**
	 * 手机号登录
	 */
	@Override
	public User selectByProtectMTel(String phoneNumber) {
		// TODO Auto-generated method stub
		return userMapper.selectByProtectMTel(phoneNumber);
	}

	
	/**
	 * 网络学生的多条件查询
	 */
	@Override
	public List<Students> findStudents(StudentsVO studentsVO) {
		// TODO Auto-generated method stub
		return userMapper.findStudents(studentsVO);
	}

	@Override
	public int getCountStudents(StudentsVO studentsVO) {
		// TODO Auto-generated method stub
		return userMapper.getCountStudents(studentsVO);
	}

	/**
	 * 新增网络学生
	 */
	@Override
	public int addStudents(Students students) {
		return userMapper.addStudents(students);
	}
	/**
	 * 查询全部咨询师角色
	 */
	@Override
	public List<User> selectAskersAll() {
		// TODO Auto-generated method stub
		return userMapper.selectAskersAll();
	}

	/**
	 * 查询需要分配咨询师的学生
     * 根据IsValid、AskerId、ZiXunName、CreateTime(升序)查询
	 */
	@Override
	public List<Students> selectAllotZXS() {
		// TODO Auto-generated method stub
		return userMapper.selectAllotZXS();
	}

	

	
	

	
	

}
